package com.box.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.box.annotation.SysLog;
import com.box.entity.DbAdmin;
import com.box.service.AdminLogService;
import com.box.service.AdminService;
import com.box.utils.LayuiResult;



/**   
*    
* 项目名称：MyBox   
* 类名称：AdminLogController   
* 类描述： 日志控制器  
* 创建人：君无邪   
* 创建时间：2019年12月7日 下午11:54:17   
* 修改备注：  https://www.java214.com 
* @version    1.0
*    
*/ 
@Controller
@RequestMapping("/adminlog")
public class AdminLogController {
	
	@Autowired
	private AdminLogService logService;
	
	@Autowired
	private AdminService adminService;
	/**
	 * 
	 * 业务逻辑
	 * 
	 * 
	 */
	//日志列表

	@RequestMapping(value="/getadminlogList",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public  LayuiResult getAdminLogList(Integer page,Integer limit){
		
		LayuiResult result = logService.getAdminLogList(page, limit);
		return result ;
	}
	
	//单个删除
	@SysLog(value="删除日志信息")
	@RequestMapping(value="/delLogByid",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public  LayuiResult delLogByid(String id){
		
		LayuiResult result = logService.delLogByid(id);
		return result ;
	}
	
	//批量删除
	@SysLog(value="批量删除日志信息")
	@RequestMapping(value="/deladminlogAll/{adminlogStr}",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public  LayuiResult deladminlogAll(@PathVariable("adminlogStr") String adminlogStr){
		
		LayuiResult result = logService.deladminlogAll(adminlogStr);
		return result ;
	}
	/**
	 * 
	 * 页面跳转
	 * 
	 * 
	 */
	@RequestMapping(value="/page/adminlog",method={RequestMethod.GET,RequestMethod.POST})	
	public  String  showAdminLogPage(Model model){
		DbAdmin dbAdminItems = adminService.getDbAdminItems();
		if(dbAdminItems!=null){
			model.addAttribute("admin", dbAdminItems );
			return "adminlog/adminlog" ;
		}else{
			return "error/404";
		}
	
		
	
	}
}
